package com.example.yunnan.service;

import com.example.yunnan.dao.goodsDao;
import com.example.yunnan.pojo.news;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class goodsServices {
    @Autowired
    goodsDao goodsDao;


    public List<news> list() {
        Sort sort = new Sort(Sort.Direction.DESC, "newsid");
        return goodsDao.findAll(sort);
    }

    public void addOrUpdate(news news) {
        goodsDao.save(news);
    }



}

